//道路挖掘
function selectDlwjQyxx(tplcode) {
  ExtElWin({id: 'selectQyxxWin', title: '选择建设单位', w: 550, h: 400, tplcode: tplcode});
}

function selectDlwjSgdw(tplcode){
	ExtElWin({id: 'selectSgdwWin', title: '选择施工单位', w: 550, h: 400, tplcode: tplcode});
}

function ExtElWin(f) {
  var w = 350;
  var h = 160;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  var qyxxGrid = new Ext.ux.grid.YwGrid({
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    margins: '1 1 1 1',
    needSelect4CsdlwjTbar:true,
    url: '/yw-com-qyxx!dataList.action?templateCode='+f.tplcode,
    keyField: 'id',
    defaultSortField: 'sqrq',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'post',
      hidden: true
    },{
      name: 'qyjc',
      hidden: true
    },{
      name: 'qyphone',
      hidden: true
    },{
      name: 'cz',
      hidden: true
    },{
      name: 'frxm',
      hidden: true
    },{
      name: 'frphone',
      hidden: true
    },{
      name: 'frtel',
      hidden: true
    },{
      name: 'gszcdjh',
      hidden: true
    },{
      name: 'qydlyszh',
      hidden: true
    },{
      name: 'gszcdjyxq',
      hidden: true
    },{
      name: 'qydlyszyxq',
      hidden: true
    },{
      name: 'ywlxr',
      hidden: true
    },{
      name: 'ywlxphone',
      hidden: true
    },{
      name: 'ywlxrtel',
      hidden: true
    },{
      name: 'address',
      hidden: true
    },{
      name: 'email',
      hidden: true
    },{
      name: 'zczj',
      hidden: true
    },{
      name: 'csmj',
      hidden: true
    },{
      name: 'frzw',
      hidden: true
    },{
      name: 'zzdj',
      hidden: true
    },{
      name: 'zsbh',
      hidden: true
    },{
      name: 'jjlx',
      hidden: true
    },{
      name: 'qyRemarks',
      hidden: true
    },{
      name: 'rsJsry',
      hidden: true
    },{
      name: 'rsWxg',
      hidden: true
    },{
      name: 'rsTotal',
      hidden: true
    },{
      name: 'dwslJyrq',
      hidden: true
    },{
      name: 'dwslGyrq',
      hidden: true
    },{
      name: 'qylx',
      hidden: true
    },{
      name: 'fddbr',
      hidden: true
    },{
      name: 'qyfzr',
      hidden: true
    },{
      name: 'sqdw',
      header: '企业名称'
    },{
      name: 'sqrq',
      header: '申请日期',
      width: 17
    }]
  });
  
  var store = qyxxGrid.store;
  var toolbar = qyxxGrid.toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      sqdw: toolbar.search_sqdw.getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'fit',
    modal     : true,
    plain     : true,
    resizeable: false,
    items     : [qyxxGrid]
  }).show();
}

function selectDlwjCallback(params) {
	try{
		if(document.forms[0].SR_DLWJSQB_JSDW && params.r.get('sqdw'))
			document.forms[0].SR_DLWJSQB_JSDW.value = params.r.get('sqdw');
		if(document.forms[0].SR_DLWJSQB_JSDW_ADDRESS && params.r.get('address'))
			document.forms[0].SR_DLWJSQB_JSDW_ADDRESS.value = params.r.get('address');
		if(document.forms[0].SR_DLWJSQB_FDDBR && params.r.get('fddbr'))
			document.forms[0].SR_DLWJSQB_FDDBR.value = params.r.get('fddbr');
		if(document.forms[0].SR_DLWJSQB_JSDW_TEL && params.r.get('ywlxphone'))
			document.forms[0].SR_DLWJSQB_JSDW_TEL.value = params.r.get('ywlxphone');
		if(document.forms[0].SR_DLWJSQB_JSDW_TEL && params.r.get('ywlxrtel'))
			document.forms[0].SR_DLWJSQB_JSDW_TEL.value = params.r.get('ywlxrtel');
		if(document.forms[0].SR_DLWJSQB_LXR && params.r.get('ywlxr'))
			document.forms[0].SR_DLWJSQB_LXR.value = params.r.get('ywlxr');
		if(document.forms[0].SR_DLWJSQB_QYBH && params.r.get('id'))
			document.forms[0].SR_DLWJSQB_QYBH.value = params.r.get('id');
	}catch(e){}
}

function selectDlwjJsdwCallback(params){
	try{
	/*
		if(document.forms[0].SR_DLWJSQB_SGDW && params.r.get('sqdw'))
			document.forms[0].SR_DLWJSQB_SGDW.value = params.r.get('sqdw');
		if(document.forms[0].SR_DLWJSQB_SGDW_ADDRESS && params.r.get('address'))
			document.forms[0].SR_DLWJSQB_SGDW_ADDRESS.value = params.r.get('address');
		if(document.forms[0].SR_DLWJSQB_AQFZR && params.r.get('fddbr'))
			document.forms[0].SR_DLWJSQB_AQFZR.value = params.r.get('fddbr');
		if(document.forms[0].SR_DLWJSQB_SGDW_TEL && params.r.get('qyphone'))
			document.forms[0].SR_DLWJSQB_SGDW_TEL.value = params.r.get('qyphone');
		if(document.forms[0].SR_DLWJSQB_SGDW_LXR && params.r.get('ywlxr'))
			document.forms[0].SR_DLWJSQB_SGDW_LXR.value = params.r.get('ywlxr');
		*/
	}catch(e){}
}


//给tabPanel添加事件，tab变换的时候，
//触发事件
function addEventListenerToTab(){
	var tabPanel = parent.Ext.getCmp('centerPanel');
	
	curTab = tabPanel.getActiveTab(); //当前活动的tab
	
	if(tabPanel){
		if(!tabPanel.hasListener('tabchange')){
			chooseToViewTab();
			tabPanel.addListener('tabchange',changeEvent);
		}
	}
}

//重写setTimeout方法，以使能够传递参数
//IE下不能传递参数
function setTimeoutForIE(pFunction, iTime, params){
     var fuckIE = function(){
             pFunction(params);    
      }
      var pTimeout = setTimeout(fuckIE, iTime);
      return pTimeout;
}

var preTab; //前一个活动的tab
var curTab;//当前活动的tab

/**
 * 根据是否是联合审批案件，选择显示哪些tab
 */
function chooseToViewTab(){
	var centerPanel__gzsrxdggcswjscb_form = parent.document.getElementById('centerPanel__gzsrxdggcswjscb_form');
	var centerPanel__dlwjyqb_form = parent.document.getElementById('centerPanel__dlwjyqb_form');
	var centerPanel__dlwjbjgz_form = parent.document.getElementById('centerPanel__dlwjbjgz_form');
	var centerPanel__srsfb_form = parent.document.getElementById('centerPanel__srsfb_form');
	var centerPanel__csdlwj_sjcl = parent.document.getElementById('centerPanel__csdlwj_sjcl');
	
	var centerPanel__gcxmjbxx_form = parent.document.getElementById('centerPanel__gcxmjbxx_form');
	var centerPanel__qyjbxx_form = parent.document.getElementById('centerPanel__qyjbxx_form');
	var centerPanel__qyzzjbxx_form = parent.document.getElementById('centerPanel__qyzzjbxx_form');
	var centerPanel__sqcl_form = parent.document.getElementById('centerPanel__sqcl_form');
	
	var mainPanel = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var lhspId = mainPanel.getElementsByName('SR_DLWJSQB_LHSP_ID')[0].value;
	if("" != lhspId){//联合审批案件 隐藏panel
		if(centerPanel__dlwjyqb_form){
			centerPanel__dlwjyqb_form.style.display="none";//隐藏延期表
		}
		if(centerPanel__dlwjbjgz_form){
			centerPanel__dlwjbjgz_form.style.display="none";//隐藏延期表
		}
		if(centerPanel__srsfb_form){
			centerPanel__srsfb_form.style.display="none";//隐藏延期表
		}
		if(centerPanel__csdlwj_sjcl){
			centerPanel__csdlwj_sjcl.style.display="none";//隐藏延期表
		}
//		parent.document.getElementById('centerPanel__gzsrxdggcswjscb_form').style.display="none";//隐藏审查表
//		parent.document.getElementById('centerPanel__dlwjyqb_form').style.display="none";//隐藏延期表
//		parent.document.getElementById('centerPanel__dlwjbjgz_form').style.display="none";//隐藏补交告知表
//		parent.document.getElementById('centerPanel__srsfb_form').style.display="none";//隐藏收费表
//		parent.document.getElementById('centerPanel__csdlwj_sjcl').style.display="none";//隐藏收件材料
	}else{
		if(centerPanel__gcxmjbxx_form){
			centerPanel__gcxmjbxx_form.style.display="none";//隐藏工程基本信息表
		}
		if(centerPanel__qyjbxx_form){
			centerPanel__qyjbxx_form.style.display="none";//隐藏企业基本信息表
		}
		if(centerPanel__qyzzjbxx_form){
			centerPanel__qyzzjbxx_form.style.display="none";//隐藏企业资质基本信息表
		}
		if(centerPanel__sqcl_form){
			centerPanel__sqcl_form.style.display="none";//隐藏申请材料表
		}
	}
}
 
//事件的响应
function changeEvent(obj){
	var item = obj.getActiveTab();
	
	//交换，获得当前和上一个活动的tab
	preTab = curTab;  
	curTab = item;
	
	var id = item.id;
	if(id == 'gzsrxdggcswjcpb_form'){ //转向呈批表
		var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
		var field = main.getElementsByName('id')[0];
		if(main && field && field.value !=''){
			item.setDisabled(false);
			setTimeoutForIE(copyElement2Cpb,1500,item);
		}
		else{
			parent.Ext.getCmp('centerPanel').setActiveTab(0);
			item.setDisabled(true);
			Ext.Msg.alert('系统提示','请先保存基本信息表单，再进行呈批表的查看！');
		}
	}else if (id == 'csdlwj_sjcl'){ //转向收件材料
		var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
		var field = main.getElementsByName('id')[0];
		if(main){
			if(main.getElementsByName('SR_DLWJSQB_QYBH')[0] && field){
				var QyId = main.getElementsByName('SR_DLWJSQB_QYBH')[0].value; 
				var AjId = main.getElementsByName('id')[0].value; 
				item.setDisabled(false);
				changeUrlAndReload(item,AjId,QyId);
			}else{
				parent.Ext.getCmp('centerPanel').setActiveTab(0);
				item.setDisabled(true);
				Ext.Msg.alert('系统提示','请先保存基本信息表单，再进行呈批表的查看！');
			}
		}
	}else if(id == 'gzsrxdggcswjscb_form'){ //转向审查表
		var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
		var field = main.getElementsByName('id')[0];
		if(main && field){
			setTimeoutForIE(copyElements2Scb,1500,item); //设置一定时间的延迟，让页面加载完成
		}else{
			parent.Ext.getCmp('centerPanel').setActiveTab(0);
			item.setDisabled(true);
			Ext.Msg.alert('系统提示','请先保存基本信息表单，再进行审查表的查看！');
		}
	}else if(id == 'SHOW_GIS'){  //转向webgis
		var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
		var objectId = main.getElementsByName('id')[0];
		if(main && objectId){
			item.setDisabled(false);
			setTimeout(copy2Gis,1000);
		}else{
			item.setDisabled(true);
		}
	}else if(id == 'gzsrxdggcswjsqb_form'){
		copysfb2sqb();
		var disabledTab = parent.Ext.getCmp('gzsrxdggcswjscb_form');
		if((preTab.id == 'gzsrxdggcswjscb_form') && disabledTab.disabled == false)
			copyBz();
		
	}
}

//copy收费表到申请表
function copysfb2sqb(){
	var doc = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var sfb;
	if(parent.document.getElementById('dlwjsfbFormIframe')){
		sfb = parent.document.getElementById('dlwjsfbFormIframe').contentWindow.document;
	}
	if(doc && sfb){
		doc.getElementsByName('SR_DLWJSQB_sfje')[0].value = sfb.getElementsByName('sfje')[0].value;
		doc.getElementsByName('SR_DLWJSQB_sfbh')[0].value = sfb.getElementsByName('sfbh')[0].value;
		doc.getElementsByName('SR_DLWJSQB_fph')[0].value = sfb.getElementsByName('fph')[0].value;		
	}
}


//复制备注内容
function copyBz(){
	var doc = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var scb = parent.document.getElementById('gzsrxdggcswjscb_formIframe').contentWindow.document;
	if(doc && scb){
		var bzhidden = doc.getElementsByName('SR_DLWJSQB_BZ')[0];
		var bzcontent = scb.getElementsByName('SR_DLWJSCB_BZ')[0];
		if(bzhidden && bzcontent)
			bzhidden.value = bzcontent.value;
	}
}

//针对webgis页面
function copy2Gis(){
	var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var gis = parent.document.getElementById('SHOW_GISIframe').contentWindow.document;
	var acceptNo = main.getElementsByName('SR_DLWJSQB_ACCEPT_NO')[0].value;
	var templateCode = WF_CONFIG.templateCode;
	var id = main.getElementsByName('id')[0].value;
	if(gis){
		//var ano = gis.getElementsByName('acceptNo')[0].value;
		//var ajid = gis.getElementsByName('id')[0].value;
		//var tid = gis.getElementsByName('templateCode')[0].value;
		//if(ano != acceptNo && ajid != id && tid != templateCode){
			//var src = ctx+'/gzcgwsp/csdlwj/flex.jsp?acceptNo='+acceptNo+'&templateCode='+templateCode+'&id='+id ;
			//parent.Ext.getDom("SHOW_GISIframe").contentWindow.location.href = src;
		//}
		var src = ctx+'/gzcgwsp/csdlwj/flex.jsp?acceptNo='+acceptNo+'&templateCode='+templateCode+'&id='+id ;
		//parent.Ext.getDom("SHOW_GISIframe").src = src; //此种方法也行
		parent.Ext.getDom("SHOW_GISIframe").contentWindow.location.href = src;
  	}
}

//复制数据到审查表中去
function copyElements2Scb(item){
	var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var scb = parent.document.getElementById('gzsrxdggcswjscb_formIframe').contentWindow.document;
	if(main && scb){
		item.setDisabled(false);
		if(scb.getElementsByName('SR_DLWJSCB_BH') && main.getElementsByName('SR_DLWJSQB_ACCEPT_NO')){			
			scb.getElementsByName('SR_DLWJSCB_BH')[0].value = main.getElementsByName('SR_DLWJSQB_ACCEPT_NO')[0].value;
		}
			
		if(scb.getElementsByName('SR_DLWJSCB_SQR')[0] && main.getElementsByName('SR_DLWJSQB_JSDW'))
			scb.getElementsByName('SR_DLWJSCB_SQR')[0].value = main.getElementsByName('SR_DLWJSQB_JSDW')[0].value;
		if(scb.getElementsByName('SR_DLWJSCB_XZXKZMC'))
			scb.getElementsByName('SR_DLWJSCB_XZXKZMC')[0].value = '城市道路挖掘审批';
		if(scb.getElementsByName('SR_DLWJSCB_BZ') && main.getElementsByName('SR_DLWJSQB_BZ'))
			scb.getElementsByName('SR_DLWJSCB_BZ')[0].value = main.getElementsByName('SR_DLWJSQB_BZ')[0].value;
	}else{
		parent.Ext.getCmp('centerPanel').setActiveTab(0);
		item.setDisabled(true);
		Ext.Msg.alert('系统提示','打开审查表出错了！');
	}
}



//从基本表单中复制相关的信息到呈批表中
function copyElement2Cpb(item){
	var sqb = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var cpb = parent.document.getElementById('gzsrxdggcswjcpb_formIframe').contentWindow.document;
	var id = sqb.getElementsByName('id')[0].value;
	if(id != null && id != ''){
		item.setDisabled(false);
		if(sqb && cpb){
			
			//受理号
			if(sqb.getElementsByName('SR_DLWJSQB_ACCEPT_NO')[0] && cpb.getElementsByName('SR_DLWJCPB_CP_ACCEPT_NO')[0]){
				cpb.getElementsByName('SR_DLWJCPB_CP_ACCEPT_NO')[0].value = sqb.getElementsByName('SR_DLWJSQB_ACCEPT_NO')[0].value;
			}
			//收件人
			if(cpb.getElementsByName('SR_DLWJCPB_SJR')[0] && sqb.getElementsByName('SR_DLWJSQB_SJR')[0]){
				cpb.getElementsByName('SR_DLWJCPB_SJR')[0].value = sqb.getElementsByName('SR_DLWJSQB_SJR')[0].value;
			}
			//收件时间
			if(cpb.getElementsByName('SR_DLWJCPB_SJSJ')[0] && sqb.getElementsByName('SR_DLWJSQB_TBRQ')[0]){
				cpb.getElementsByName('SR_DLWJCPB_SJSJ')[0].value = sqb.getElementsByName('SR_DLWJSQB_TBRQ')[0].value;
			}
			//申请单位
			if(cpb.getElementsByName('SR_DLWJCPB_SQDW')[0] && sqb.getElementsByName('SR_DLWJSQB_JSDW')[0]){
				cpb.getElementsByName('SR_DLWJCPB_SQDW')[0].value = sqb.getElementsByName('SR_DLWJSQB_JSDW')[0].value;
			}
			//申请业务
			if(cpb.getElementsByName('SR_DLWJCPB_SQYW')[0] && sqb.getElementsByName('SR_DLWJSQB_CBYW')[0]){
				cpb.getElementsByName('SR_DLWJCPB_SQYW')[0].value = sqb.getElementsByName('SR_DLWJSQB_CBYW')[0].value;
			}
			//联系人
			if(cpb.getElementsByName('SR_DLWJCPB_LXR')[0] && sqb.getElementsByName('SR_DLWJSQB_LXR')[0]){
				cpb.getElementsByName('SR_DLWJCPB_LXR.value')[0] = sqb.getElementsByName('SR_DLWJSQB_LXR')[0].value;
			}
			//联系电话
			if(cpb.getElementsByName('SR_DLWJCPB_LXDH')[0] && sqb.getElementsByName('SR_DLWJSQB_JSDW_TEL')[0]){
				cpb.getElementsByName('SR_DLWJCPB_LXDH')[0].value = sqb.getElementsByName('SR_DLWJSQB_JSDW_TEL')[0].value;
			}
			//承办部门
			if(cpb.getElementsByName('SR_DLWJCPB_CBBM')[0] && sqb.getElementsByName('SR_DLWJSQB_CBBM')[0]){
				cpb.getElementsByName('SR_DLWJCPB_CBBM')[0].value = sqb.getElementsByName('SR_DLWJSQB_CBBM')[0].value;
			}
			//呈批时间
			if(cpb.getElementsByName('SR_DLWJCPB_CPSJ')[0] && sqb.getElementsByName('SR_DLWJSQB_CPSJ')[0]){
				cpb.getElementsByName('SR_DLWJCPB_CPSJ')[0].value = sqb.getElementsByName('SR_DLWJSQB_CPSJ')[0].value;
			}
			//公示时间
			if(cpb.getElementsByName('SR_DLWJCPB_GSSJ')[0] && sqb.getElementsByName('SR_DLWJSQB_GSSJ')[0]){
				cpb.getElementsByName('SR_DLWJCPB_GSSJ')[0].value = sqb.getElementsByName('SR_DLWJSQB_GSSJ')[0].value;
			}
			//答复时间
			if(cpb.getElementsByName('SR_DLWJCPB_DFSJ')[0] && sqb.getElementsByName('SR_DLWJSQB_DFSJ')[0]){
				cpb.getElementsByName('SR_DLWJCPB_DFSJ')[0].value = sqb.getElementsByName('SR_DLWJSQB_DFSJ')[0].value;
			}
		}
	}else{
		parent.Ext.getCmp('centerPanel').setActiveTab(0);
		item.setDisabled(true);
		Ext.Msg.alert('系统提示','请先保存基本信息表，后再查看呈批表！');
	}
}

//根据模板编号、案件编号、企业编号
//对收件材料表单重新定向
function changeUrlAndReload(item,AjId,QyId){
	var isupdate="";//环节名称对文书的操作参数
    if(WF_CONFIG.activityName!="jbrcs" && WF_CONFIG.activityName!="cksa"){
    	isupdate="false";
    }
	if(!Ext.isEmpty(AjId)){
		item.setDisabled(false);
		if(item){
			var elementCode ='csdlwj_sjcl';
			var src = 'yw-com-sjcllist!ywList.action?tplcode='+WF_CONFIG.templateCode+'&ajid='+AjId+'&qyid='+QyId+'&isUpdate='+isupdate;
			parent.Ext.getDom("csdlwj_sjclIframe").src = src;
			//parent.Ext.getDom("csdlwj_sjclIframe").contentWindow.location.href = src;
		}
	}else{
		parent.Ext.getCmp('centerPanel').setActiveTab(0);
		item.setDisabled(true);
		Ext.Msg.alert('系统提示','请先保存基本信息表，后再查看收件材料表！');
	}
}

//验证提交的表单
function checkElementBeforeSubmit(){
	var obj;
	var sqdw = document.getElementsByName('SR_DLWJSQB_JSDW')[0];
	var sgdw = document.getElementsByName('SR_DLWJSQB_SGDW')[0];
	var tbrq = document.getElementsByName('SR_DLWJSQB_TBRQ')[0];
	var jsdwtel = document.getElementsByName('SR_DLWJSQB_JSDW_TEL')[0];
	var lxr = document.getElementsByName('SR_DLWJSQB_LXR')[0];
	var sgdwtel = document.getElementsByName('SR_DLWJSQB_SGDW_TEL')[0];
	var sgdwlxr = document.getElementsByName('SR_DLWJSQB_SGDW_LXR')[0];
	if(sqdw.value == ''){
		obj = {
			result:false,
			text:'系统提示：建设单位不能为空！',
			target:sqdw
		};
		return obj;
	}
	if(jsdwtel.value == ''){
		obj = {
			result:false,
			text:'系统提示：电话不能为空！',
			target:jsdwtel
		};
		return obj;
	}
	if(lxr.value == ''){
		obj = {
			result:false,
			text:'系统提示：联系人不能为空！',
			target:lxr
		};
		return obj;
	}
	if(sgdw.value == ''){
		obj = {
			result:false,
			text:'系统提示：施工单位不能为空！',
			target:sgdw
		};
		return obj;
	}
	if(sgdwtel.value == ''){
		obj = {
			result:false,
			text:'系统提示：电话不能为空！',
			target:sgdwtel
		};
		return obj;
	}
	if(sgdwlxr.value == ''){
		obj = {
			result:false,
			text:'系统提示：联系人不能为空！',
			target:sgdwlxr
		};
		return obj;
	}
	
	if(tbrq.value == ''){
		obj = {
			result:false,
			text:'系统提示：填表日期不能为空！',
			target:tbrq
		};
	   return obj;
	}
	
	obj = {
		result:true,
		text:'验证通过',
		target:null
	};
	return obj;
}

//验证收件材料
function myValidate(id){
	var sjcl = parent.document.getElementById(id).contentWindow;
	var _sjclList = sjcl.document.getElementById('sjcl_list');
	var obj = null;
	if(_sjclList != null)
	{
		for(var i=1;i<_sjclList.rows.length;i++)
		{
			var _childNodes=_sjclList.rows[i].cells;
			if(_sjclList.rows[i].hasExists == 'false')
			{
			    var alertText =  '*'+_childNodes[1].innerHTML+'\u6CA1\u6709\u4E0A\u4F20,\u8BF7\u5148\u4E0A\u4F20\u8BE5\u9644\u4EF6!';
				obj = {text:alertText,result:false};
				return obj;
			}
		}
		obj = {text:null,result:true};
	}
    return obj;
}

function preViewXkzs(){
	var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var id = main.getElementsByName('id')[0].value;
	var templateCode = WF_CONFIG.templateCode;
   	//if(<wf:hasPriv activities="jbrbj" />){
        openCenterWindow(ctx+'/smart-form-csdlwj!preViewXkzs.action?id='+id+'&hjmc=jbrbj&templateCode='+templateCode, 1100, 650);
    //}else if(<wf:hasPriv activities="ckfsgz" />){
       	//openCenterWindow(ctx + '/smart-form-csdlwj!preViewXkzs.action?id='+id+'&hjmc=ckfsgz', 1100, 650);
    //}
    
}

function xkzgz(){
	var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var id = main.getElementsByName('id')[0].value;
    openCenterWindow(ctx+'/smart-form-csdlwj!gzViewXkz.action?id='+id+'&hjmc=jbrbj', 1100, 650);
}

//公示
function gs(){
	var main = parent.document.getElementById('gzsrxdggcswjsqb_formIframe').contentWindow.document;
	var id = main.getElementsByName('id')[0].value;
	var url="${ctx}/smart-form-csdlwj!gs.action";
	$.ajax({
		url : url,
		type : "post",
		dataType : "html",
		data : {
        'id': id
      },
		success : function(msg) {
			if(msg == "success"){
				alert("公示成功！");
			}else{
				alert(msg);
			}							
		},
		error:function() {
			alert("公示失败！");
		}
	});
}